<?php

namespace Gdkl10\Controller;

class DanshuangjsonController extends CommonController {
	
	function ds(){
		// 周期
		if (I ( "zhouqi" ) == null) {
			$zhouqi = 3;
		} else {
			$zhouqi = I ( "zhouqi" );
		}
		// 定码
		if (I ( "disnum" ) == null) {
			$disnum = 4;
		} else {
			$disnum = I ( "disnum" );
		}
		//公式
		if (I ( "gongshi" ) == null) {
			$gongshi = 1;
		} else {
			$gongshi = I ( "gongshi" );
		}
		//位数
		if (I ( "weishu" ) == null) {
			$weishu = 1;//个位
		} else {
			$weishu = I ( "weishu" );
		}
		//只留前30期
		if(I("zqnum")==null){
			$zqnum = 30;
		}else{
			$zqnum = I("zqnum");
		}	
		$this->dm_data($zhouqi,$disnum,$gongshi,$weishu,$zqnum);
	}
	
	//周期,定码,公式,位数1-5分别表示个十百千万
	function dm_data($zhouqi=3,$disnum=4,$gongshi=1,$weishu=1,$zqnum=30){
		//获取公式表名
		$gongshi_m = gdkl10_num_to_gongshi($gongshi);
		//获取位数
		$weishu_arr = gdkl10_num_to_weishu($weishu);
		// 获取当天的所有推荐
		$result_tjsj = gdkl10_get_new_tj();
		//获取定码统计列表
		$result_arr = gdkl10_get_danshuang_data($result_tjsj, $weishu_arr, $disnum, $zhouqi);
		//统计中挂
		$json_result = gdkl10_get_tongji_result($result_arr, $zqnum, $disnum, $zhouqi, $gongshi, $weishu);
	
		echo json_encode($json_result,JSON_UNESCAPED_UNICODE);
	}
}








